//
//  YDOAChargeCell.swift
//  YDOAProduct
//
//  Created by YDWY on 2017/6/6.
//  Copyright © 2017年 Allen. All rights reserved.
//

import UIKit

class YDOAChargeCell: UITableViewCell {

   
    @IBOutlet weak var textView: UITextView!
    @IBOutlet weak var freeCount: UITextField!
    @IBOutlet weak var ticketNum: UITextField!
    

    //选择科目
    @IBAction func chooseType(_ sender: Any) {
        YMLog.log(item: "点击了选择科目")
        
    }
    
    var model : YDOAFreeModel!{
        didSet{
            textView.text = model.liyou
            freeCount.text = model.payCount
            ticketNum.text = model.num

        }
    }
    
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        textView.delegate = self
        freeCount.delegate = self
        ticketNum.delegate = self

        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}

extension YDOAChargeCell : UITextViewDelegate,UITextFieldDelegate {

    func textViewDidEndEditing(_ textView: UITextView) {
        model.liyou = textView.text
    }
    
    func textFieldDidEndEditing(_ textField: UITextField) {
        if textField == freeCount {
            model.payCount = textField.text
        }else{
            model.num = textField.text
        }
    }
    
}



